#include<stdio.h>
int main()
{
    int pa,pb,a[3];
    int i,s1=0,s2=0;
    scanf("%d%d%d%d%d",&pa,&pb,a,a+1,a+2);
    for(i=0;i<3;i++)
    {
        if(a[i]==0)
            s1++;
        else
            s2++;
    }
    if(pa>pb)
    {
        if(s1!=0)
            printf("The winner is a: %d + %d",pa,s1);
        else
            printf("The winner is b: %d + %d",pb,s2);
    }
    else
    {
        if(s1==3)
            printf("The winner is a: %d + %d",pa,s1);
        else
            printf("The winner is b: %d + %d",pb,s2);
    }
    return 0;
}
